<?php
require_once (HOME . '/include/base/BackendController.php');
class test extends BackendController {
	function __construct() {
		$this->test ();
	}
	function test() {
		parent::__construct ();
	}
	function abc() {
		$this->assign ( "hello", "测试assign成功!!!" );
		$this->display ( "acategory.edit.layout.html" );
	}
	function testLink() {
		// $result = spClass("m_department")->spLinker()->findAll();
		// dump($result);
		$ruleArray = spClass ( "m_privilege" )->find ( 'privilege_id <> 2', 'privilege_id', 'employee_deny,employee_allow,department_deny,department_allow' );
		
		dump ( $ruleArray );
		
		dump ( json_decode ( $ruleArray ['employee_deny'] ) );
		dump ( json_decode ( $ruleArray ['employee_allow'] ) );
		dump ( json_decode ( $ruleArray ['department_deny'] ) );
		dump ( json_decode ( $ruleArray ['department_deny'] ) );
		
		$convert = json_decode ( $ruleArray ['employee_deny'] );
	}
	function testpid() {
		$result = spClass ( "mid_privilege_department" )->getAllBypid ( "1" );
		dump ( $result );
	}
	function getdep() {
		$department_id = spClass ( "m_employee" )->spLinker ()->find ( array (
				'employee_id' => '1' 
		) );
		$department_id = $department_id ['department'] [0] ['department_id'];
		dump ( $department_id );
		
		$auth_department = spClass ( "mid_privilege_department" )->find ( array (
				'privilege_id' => '1',
				'department_id' => '1' 
		), 'department_id', 'allow' );
		
		dump ( $auth_department );
		
		$auth_employee = spClass ( "mid_privilege_employee" )->find ( array (
				'privilege_id' => '1',
				'employee_id' => '1' 
		), 'employee_id', 'allow' );
		
		dump ( $auth_employee );
	if(spClass ( "m_privilege" )->checkAuth ( 'e4da3b7fbbce2345d7772b0674a318d5', '1' ) )
		echo "1";
	}
	
	function testtab(){
		$this->display('sample.content.html');
	}
	
	function testsession(){
		$_SESSION['test'] = 'xxx';
	}
	
}
?>

